﻿using Mimi.Models.DataModels;
using Mimi.ViewModels;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mimi.Models.UIModels
{
    public class UIExpense : BindingBase
    {
        #region Properties
        private string expenseName;
        /// <summary>
        /// Store expense name that is bound to UI
        /// </summary>
        public string ExpenseId
        {
            get { return expenseName; }
            set
            {
                Set(ref expenseName, value);
            }
        }

        private string description;
        /// <summary>
        /// Store expense description that is bound to UI
        /// </summary>
        public string Description
        {
            get { return description; }
            set
            {
                Set(ref description, value);
            }
        }

        private string amount;
        /// <summary>
        /// Store expense quota that is bound to UI
        /// </summary>
        public string Amount
        {
            get { return amount; }
            set
            {
                Set(ref amount, value);
            }
        }

        private string createdDate;
        /// <summary>
        /// Store created date of expense
        /// </summary>
        public string CreatedDate
        {
            get { return createdDate; }
            set
            {
                Set(ref createdDate, value);
            }
        }

        private string purpose;
        /// <summary>
        /// Purpose that expense is spent on
        /// </summary>
        public string Purpose
        {
            get { return purpose; }
            set
            {
                Set(ref purpose, value);
            }
        }
        #endregion

        #region Methods
        /// <summary>
        /// Default constructor
        /// </summary>
        public UIExpense()
        {

        }

        /// <summary>
        /// Parameter constructor
        /// </summary>
        /// <param name="expense"></param>
        public UIExpense(Expense expense)
        {
            this.ExpenseId = expense.ExpenseId;
            this.Description = expense.Description;
            this.Amount = expense.Amount.ToString("N0", CultureInfo.CreateSpecificCulture("en-US"));
            this.CreatedDate = expense.Date.ToShortDateString();
            this.Purpose = expense.SpentOn.Description;
        }
        #endregion
    }
}
